package com.chengqj.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * Copyright © 2021年 tx-demo. All rights reserved.
 *
 * @author chengqj
 * TODO: 为了共建和谐社会，请为该类写点注释吧...
 * version 1.0.0 (接口必须带上)
 * @date 2021/3/29 21:36
 */
@LocalTCC
public interface IOrderService {
    /**
     * Prepare boolean.
     *
     * @param actionContext the action context
     * @param userId             the a
     * @return the boolean
     */
    @TwoPhaseBusinessAction(name = "IOrderService" , commitMethod = "commit", rollbackMethod = "rollback")
    public boolean prepare(BusinessActionContext actionContext,
                           @BusinessActionContextParameter(paramName = "userId") String userId);

    /**
     * Commit boolean.
     *
     * @param actionContext the action context
     * @return the boolean
     */
    public boolean commit(BusinessActionContext actionContext);

    /**
     * Rollback boolean.
     *
     * @param actionContext the action context
     * @return the boolean
     */
    public boolean rollback(BusinessActionContext actionContext);
}
